(()=>{

    class Person{
        name!: string  // ! 表示可以不用赋值
        age!: number

        constructor(name:string,age:number){

            this.name = name
            this.age = age
        }

        show(){
            console.log(this.name,this.age)
        }
    }

    let p = new Person('yejing',35)

    p.show()

    // 继承
    class Worker extends Person{

        work(){
            console.log('我能打工')
        }
    }

    let w = new Worker('张三',35)
    w.show()
    w.work()
    
})()